var str = 'To be, or not to be, that is the question.';

console.log(str.lastIndexOf('at is'));       // 23
console.log(str.lastIndexOf('not '));    // 10
console.log(str.lastIndexOf('nonexistent')); // -1
console.log(str.lastIndexOf('To be', 1));    // 0
console.log(str.lastIndexOf('TO BE'));       // -1